// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-7-5

#include "stdafx.h"
#include ".\brushwnd.h"

IMPLEMENT_DYNAMIC(CJoyBrushWnd, CJoyWnd)

//##ModelId=44CF17B9030D
CJoyBrushWnd::CJoyBrushWnd(void)
{
    m_skinArea = true;
    m_skinAlign = true;
}

//##ModelId=44CF17B9030F
CJoyBrushWnd::~CJoyBrushWnd(void)
{
}

BEGIN_MESSAGE_MAP(CJoyBrushWnd, CJoyWnd)
END_MESSAGE_MAP()

//##ModelId=44CF17B90306
void CJoyBrushWnd::CM_Draw(Graphics& graph)
{
    if(m_image == NULL)
    {
        return;
    }
    TextureBrush brush(m_image);
    graph.FillRectangle(&brush, 0, 0, m_area.Width(), m_area.Height());
}

//##ModelId=44CF17B90303
void CJoyBrushWnd::CM_LoadSkin(CJoyXmlElement* pSkinElem)
{
    __super::CM_LoadSkin(pSkinElem);

    CString strImage = pSkinElem->ReadString("image");
    if(!strImage.IsEmpty())
    {
        m_image = JoyGetManager()->CreateImage(strImage);
    }
}
